<%@ Page Language="C#"  MasterPageFile="~/MyMasterPage.master" AutoEventWireup="true" CodeFile="Blog.aspx.cs" Inherits="Blog" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<% string siteDirName =Application["siteDirName"].ToString(); %>
<% string extension = Application["extension"].ToString(); %>  
<script type="text/javascript" src="<%=siteDirName %>Js/JavascriptLib/wz_tooltip.js"></script>
<script type="text/javascript" src="<%=siteDirName %>Js/JavascriptLib/tip_balloon.js"></script>
     		<div class="right_side">
			   <div class="nav">
			       
			       <asp:TreeView NodeWrap="true" ID="TreeView1" 
			                     OnTreeNodePopulate="tvwBlogArchive_TreeNodePopulate"
			                     
			                     runat="server" ExpandDepth="2" ShowLines="True">
                    <Nodes>
                        <asp:TreeNode NavigateUrl='~/Blog/Blog.aspx' Text="Blog Archive" SelectAction="SelectExpand"  PopulateOnDemand="True" Value="Year">
                        </asp:TreeNode>
                    </Nodes>
                  </asp:TreeView>
                            
                   <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
                   <br /><br /><br />
                   
                   <h2>Latest Posts:</h2>
                     <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:Personal %>"
                                        SelectCommand="SELECT TOP (4) BlogID, PostTitle AS PostTitleLinks, 
                                                       REPLACE(PostTitle, ' ', '-') AS PostTitle, DAY(PostDate) AS date,
                                                       MONTH(PostDate) AS month, YEAR(PostDate) AS year, PostContent, 
                                                       PostDate, PostedBy, PostCaption
                                                       FROM Blog 
                                                       ORDER BY PostDate DESC, PostTitle">
                     </asp:SqlDataSource>
                     
                     <ul> 
                      <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource3">
                        <ItemTemplate>
                         <li>
                             <% string siteDirName =Application["siteDirName"].ToString(); %>
                             <% string extension = Application["extension"].ToString(); %>  
                            <a href="<%=siteDirName %>Blog/<%# Eval("date")%>/<%# Eval("month")%>/<%# Eval("year")%>/<%# Eval("BlogID")%>/<%# Eval("PostTitle")%><%=extension%>"><%# Eval("PostTitleLinks")%></a>
                        </li>
                        </ItemTemplate>
                      </asp:Repeater>
                  </ul>
                  <br /><br />
                  <h2>Tag Cloud:</h2>
                    <asp:Label ID="lblCloudTagsLinks" runat="server" Text="Label"></asp:Label><br />
                    <br /><br />
                    
                  <h2>Blog Calender</h2>  
                   <asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender" 
                       NextPrevFormat="ShortMonth"></asp:Calendar>
                             		  <br /><br />
		          <h2>RSS Feeds:</h2>
		          <ul>
		            <li><a  href='<%=siteDirName %>media/feeds/BlogRSS.xml'>
		                             <img alt='click here to blog feed'
		                                  title='click here to load feed' 
		                                  src='<%=siteDirName %>media/feeds/rss.png' />
		                               
		                 <span style="vertical-align:top"><b>Blog Feed</b></span> 
		                </a>
		              </li>
		              <li>  
                        <a href="http://www.addthis.com/feed.php?pub=saiket&h1=<%=siteDirName %>media/feeds/BlogRSS.xml" 
                          target="_blank" title="Subscribe Blog Feed using any feed reader!">
                        <img src="http://s9.addthis.com/button1-fd.gif"
                         width="125" height="16" border="0" alt="Subscribe Blog Feed using any feed reader!" />
                         </a>
		            </li>
		          </ul>
              </div>
			</div>
		
			<div class="left_side" style="text-align: justify">
                <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" 
                    Width="496px" onitemdatabound="DataList1_ItemDataBound">
                    <ItemTemplate>
                       <h2><asp:Label ID="PostTitleLabel" runat="server" Text='<%# Eval("PostTitle") %>'></asp:Label></h2>
                       <h3><asp:Label ID="PostCaptionLabel" runat="server" Text='<%# Eval("PostCaption") %>'></asp:Label> 
                           Tags:<asp:Label ID="Label3" runat="server" Text='<%# Eval("PostTags") %>'></asp:Label></h3>
                       <% string siteDirName = Application["siteDirName"].ToString() ;%>
                       <% string extension = Application["extension"].ToString(); %> 
                       <div class="padding" style="text-align: justify">
                              <div class="img">
                            <img  alt='<%# Eval("PostTitle") %>' title='<%# Eval("PostTitle") %>'  src="<%=siteDirName%>media/blog/<%# Eval("BlogID") %>.png" />
                      </div>
        		            <asp:Label ID="PostContentLabel" runat="server" Text='<%# Eval("PostContent") %>'></asp:Label>
                      </div>                         
                      <p class="date"> 
                       
                       <input id="title" runat="server"  type="hidden" value='<%# Eval("PostTitle") %>'/>
                       <input id="permaLink" runat="server"  type="hidden" value='<%# Eval("date")+"/"+Eval("month")+"/"+Eval("year")+"/"+Eval("BlogID")+"/"+Eval("PostTitleLinks")%>'/>
                       <input id="publisher" runat="server"  type="hidden" value='<%# Eval("PostedBy") %>'/>
                        <%-- the book mark level is filled in DataList1_ItemDataBound --%>
                     <asp:Label ID="bookmark" CssClass="bookmark" runat="server"></asp:Label>
                         
                         <a href='<%=siteDirName %>Post/Comments/<%# Eval("BlogID") %>/<%# Eval("PostTitleLinks") %><%=extension%>'>
                          Comments(<%# Eval("CommentCount")%>)</a>
                          Posted By                       
                          <asp:Label ID="PostedByLabel" runat="server" Text='<%# Eval("PostedBy") %>'></asp:Label> 
                          | 
                          <asp:Label ID="Label2" runat="server" Text='<%# Eval("PostDate") %>'></asp:Label>
                       </p>
                    </ItemTemplate>
                </asp:DataList>
                <asp:SqlDataSource ID="SqlDataSource1" 
                                    runat="server" 
                                    ConnectionString="<%$ ConnectionStrings:Personal %>"
                                    SelectCommand="SELECT TOP (4) BlogID, PostTitle,
                                                   REPLACE(PostTitle, ' ', '-') AS PostTitleLinks, PostContent,PostDate,  
                                                   PostedBy, PostCaption,PostTags, DAY(PostDate) AS date,
                                                       MONTH(PostDate) AS month, YEAR(PostDate) AS year,
                                                   (SELECT COUNT(CommentID) AS Expr1 FROM BlogComment WHERE (Blog.BlogID = BlogID)
                                                   AND (IsPublished='True')) AS CommentCount 
                                                   FROM Blog 
                                                   ORDER BY PostDate DESC, PostTitle">
                </asp:SqlDataSource>
           
          </div>
</asp:Content>

